import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/categories',
      name: 'categories',
      component: () => import('../layouts/CategoriesLayout.vue'),
      children: [
        {
          path: '',
          name: 'category',
          component: () => import('../views/CategoryView.vue'),
          children: [
            {
              path: '/produts',
              name: 'products',
              component: () => import('../layouts/ProductsLayout.vue'),
              children: [
                {
                  path: '',
                  name: 'product',
                  component: () => import('../views/ProductView.vue')
                }
              ]
            }
          ]
        }
      ]
    },
    {
      path: '/:pathMatch(.*)*',
      name: 'not-found',
      component: () => import('../views/NotFoundView.vue')
    }
  ]
})

export default router
